import request from "@/utils/request";

export function login(data) {
    return request({
        url: "/api/public/user/oauth",
        method: "post",
        data,
    });
}

export function getInfo(token) {
    return request({
        url: "/api/user/info",
        method: "get",
        params: { token },
    });
}

export function logout() {
    return request({
        url: "/api/user/quit",
        method: "get",
    });
}

export function getList(params) {
    return request({
        url: "/api/user/selectPage",
        method: "get",
        params,
    });
}

// 添加
export function add(data) {
    return request({
        url: "/api/user/insert",
        method: "post",
        data,
    });
}

// 编辑
export function update(data) {
    return request({
        url: "/api/user/update",
        method: "put",
        data,
    });
}

// 删除
export function deleteRow(params) {
    return request({
        url: "/api/user/delete",
        method: "delete",
        params,
    });
}

// 查询用户角色
export function getUserRole(params) {
    return request({
        url: "/api/user/getRoles",
        method: "get",
        params,
    });
}

export function saveUserRole(data) {
    return request({
        url: "/api/user/updateUserRole",
        method: "put",
        data,
    });
}
